package cn.xxi.ai.workflow.state;

import java.util.Map;
import java.util.stream.Collectors;

public class StateExtensions {
    public static Map<String, Object> clean(Map<String, Object> map) {
        return map.entrySet().stream()
            .filter(e -> !e.getKey().startsWith("CHAT_CONTEXT"))
            .collect(Collectors.toMap(
                e -> e.getKey().substring(e.getKey().lastIndexOf('.') + 1),
                Map.Entry::getValue
            ));
    }
}